package com.ehotting.edsta.circuitDesign.enums;

/**
 * 数字信号：信号输入类型
 */
public enum DigitalTypeEnum {

    Source(0,"s","源型"),
    Leaky(1,"c","漏型"),
    Order(2,"o","其它");

    private Integer value;
    private String code;
    private String name;

    DigitalTypeEnum(Integer value,String code,String name){
        this.code=code;
        this.name=name;
    }

    public Integer getValue() {
        return value;
    }

    public void setValue(Integer value) {
        this.value = value;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static DigitalTypeEnum getByCode(String code){
        DigitalTypeEnum[] digitalTypeArray = DigitalTypeEnum.values();
        for(DigitalTypeEnum d : digitalTypeArray){
            if(d.code.equals(code)){
                return d;
            }
        }
        return DigitalTypeEnum.Order;
    }
}
